<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var hang = function (amout, conis) {
      const dp = new Array(amout + 1).fill(0)
      console.log(dp)
      dp[0] = 1
      for (const con of conis) {
        for (var i = con; i <= amout; i++) {
          dp[i] += dp[i - con]
        }
      }
      return dp[amout]
    }
    console.log(hang(amout = 5, conis = [1, 2, 5]))
  </script>
</body>

</html>